package com.ace.scenep.day0115;



public class MyTaskQueenTest {
    public static void main(String[] args) {
        MyTaskQueen taskQueue = new MyTaskQueen();
        
        // 添加不同优先级的任务
        taskQueue.addTask(() -> {
            System.out.println("Low priority task");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
            }
        }, MyTaskQueen.Priority.LOW);
        
        taskQueue.addTask(() -> {
            System.out.println("High priority task");
        }, MyTaskQueen.Priority.HIGH);
        
        taskQueue.addTask(() -> {
            System.out.println("Medium priority task");
        }, MyTaskQueen.Priority.MEDIUM);
        
        // 查看待执行任务数量
        System.out.println("Pending tasks: " + taskQueue.getPendingTaskCount());
        
        // 等待一段时间后关闭
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
        
        taskQueue.shutdown();
    }
} 